<!DOCTYPE html>
<html lang="zh-cn">
  <head>
    
    <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Hugo 0.56.3 with theme Tranquilpeak 0.4.7-BETA">
<meta name="author" content="iFence">
<meta name="keywords" content="">
<meta name="description" content="前言 pandas的DataFrame是类似于一张表的结构，但是并没有像数据库表那样的SQL操作。虽然如此，它依然可以使用python语言的风格实现SQL中的所有操作。 where、limit、sort by和order by 首先我们讲一些常用的最基本的SQL操作。，首先创建一个DataF">


<meta property="og:description" content="前言 pandas的DataFrame是类似于一张表的结构，但是并没有像数据库表那样的SQL操作。虽然如此，它依然可以使用python语言的风格实现SQL中的所有操作。 where、limit、sort by和order by 首先我们讲一些常用的最基本的SQL操作。，首先创建一个DataF">
<meta property="og:type" content="article">
<meta property="og:title" content="pandas">
<meta name="twitter:title" content="pandas">
<meta property="og:url" content="https://ifence.gitee.io/2019/12/pandas/">
<meta property="twitter:url" content="https://ifence.gitee.io/2019/12/pandas/">
<meta property="og:site_name" content="iFence&#39;s Nest">
<meta property="og:description" content="前言 pandas的DataFrame是类似于一张表的结构，但是并没有像数据库表那样的SQL操作。虽然如此，它依然可以使用python语言的风格实现SQL中的所有操作。 where、limit、sort by和order by 首先我们讲一些常用的最基本的SQL操作。，首先创建一个DataF">
<meta name="twitter:description" content="前言 pandas的DataFrame是类似于一张表的结构，但是并没有像数据库表那样的SQL操作。虽然如此，它依然可以使用python语言的风格实现SQL中的所有操作。 where、limit、sort by和order by 首先我们讲一些常用的最基本的SQL操作。，首先创建一个DataF">
<meta property="og:locale" content="zh-cn">

  
    <meta property="article:published_time" content="2019-12-22T22:41:21">
  
  
    <meta property="article:modified_time" content="2019-12-22T22:41:21">
  
  
  
    
      <meta property="article:section" content="Python">
    
  
  
    
      <meta property="article:tag" content="python">
    
      <meta property="article:tag" content="pandas">
    
      <meta property="article:tag" content="DataFrame">
    
  


<meta name="twitter:card" content="summary">











  <meta property="og:image" content="https://avatars1.githubusercontent.com/u/53120100?s=460&v=4">
  <meta property="twitter:image" content="https://avatars1.githubusercontent.com/u/53120100?s=460&v=4">


    <title>pandas</title>

    <link rel="icon" href="https://ifence.gitee.io/favicon.png">
    

    

    <link rel="canonical" href="https://ifence.gitee.io/2019/12/pandas/">

    
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.4/jquery.fancybox.min.css" integrity="sha256-vuXZ9LGmmwtjqFX1F+EKin1ThZMub58gKULUyf0qECk=" crossorigin="anonymous" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.4/helpers/jquery.fancybox-thumbs.min.css" integrity="sha256-SEa4XYAHihTcEP1f5gARTB2K26Uk8PsndQYHQC1f4jU=" crossorigin="anonymous" />
    
    
    <link rel="stylesheet" href="https://ifence.gitee.io/css/style-twzjdbqhmnnacqs0pwwdzcdbt8yhv8giawvjqjmyfoqnvazl0dalmnhdkvp7.min.css" />
    
    

    
      
<script type="application/javascript">
var doNotTrack = false;
if (!doNotTrack) {
	(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
	(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
	m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
	})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
	ga('create', 'UA-123-45', 'auto');
	
	ga('send', 'pageview');
}
</script>

    
    
  </head>

  <body>
    <div id="blog">
      <header id="header" data-behavior="5">
  <i id="btn-open-sidebar" class="fa fa-lg fa-bars"></i>
  <div class="header-title">
    <a class="header-title-link" href="https://ifence.gitee.io/">iFence&#39;s Nest</a>
  </div>
  
    
      <a class="header-right-picture "
         href="https://ifence.gitee.io/#about">
    
    
    
      
        <img class="header-picture" src="https://avatars1.githubusercontent.com/u/53120100?s=460&amp;v=4" alt="作者的图片" />
      
    
    </a>
  
</header>

      <nav id="sidebar" data-behavior="5">
  <div class="sidebar-container">
    
      <div class="sidebar-profile">
        <a href="https://ifence.gitee.io/#about">
          <img class="sidebar-profile-picture" src="https://avatars1.githubusercontent.com/u/53120100?s=460&amp;v=4" alt="作者的图片" />
        </a>
        <h4 class="sidebar-profile-name">iFence</h4>
        
          <h5 class="sidebar-profile-bio">虽千万人吾往矣</h5>
        
      </div>
    
    <ul class="sidebar-buttons">
      
  <li class="sidebar-button">
    
      <a class="sidebar-button-link " href="https://ifence.gitee.io/">
    
      <i class="sidebar-button-icon fa fa-lg fa-home"></i>
      
      <span class="sidebar-button-desc">首页</span>
    </a>
  </li>

  <li class="sidebar-button">
    
      <a class="sidebar-button-link " href="https://ifence.gitee.io/archives">
    
      <i class="sidebar-button-icon fa fa-lg fa-archive"></i>
      
      <span class="sidebar-button-desc">归档</span>
    </a>
  </li>

  <li class="sidebar-button">
    
      <a class="sidebar-button-link " href="https://ifence.gitee.io/tags">
    
      <i class="sidebar-button-icon fa fa-lg fa-tags"></i>
      
      <span class="sidebar-button-desc">标签</span>
    </a>
  </li>

  <li class="sidebar-button">
    
      <a class="sidebar-button-link " href="https://ifence.gitee.io/categories">
    
      <i class="sidebar-button-icon fa fa-lg fa-bookmark"></i>
      
      <span class="sidebar-button-desc">分类</span>
    </a>
  </li>

  <li class="sidebar-button">
    
      <a class="sidebar-button-link " href="https://ifence.gitee.io/about">
    
      <i class="sidebar-button-icon fa fa-lg fa-user"></i>
      
      <span class="sidebar-button-desc">关于</span>
    </a>
  </li>


    </ul>
    <ul class="sidebar-buttons">
      
  <li class="sidebar-button">
    
      <a class="sidebar-button-link " href="https://github.com/iFence" target="_blank" rel="noopener">
    
      <i class="sidebar-button-icon fa fa-lg fa-github"></i>
      
      <span class="sidebar-button-desc">GitHub</span>
    </a>
  </li>

  <li class="sidebar-button">
    
      <a class="sidebar-button-link " href="https://blog.csdn.net/Vector97" target="_blank" rel="noopener">
    
      <i class="sidebar-button-icon fa fa-lg fa-codiepie"></i>
      
      <span class="sidebar-button-desc">CSDN</span>
    </a>
  </li>

  <li class="sidebar-button">
    
      <a class="sidebar-button-link " href="https://www.jianshu.com/u/424596d51c5a" target="_blank" rel="noopener">
    
      <i class="sidebar-button-icon fa fa-lg fa-gratipay"></i>
      
      <span class="sidebar-button-desc">简书</span>
    </a>
  </li>


    </ul>
    <ul class="sidebar-buttons">
      

    </ul>
  </div>
</nav>

      

      <div id="main" data-behavior="5"
        class="
               hasCoverMetaIn
               ">
        <article class="post" itemscope itemType="http://schema.org/BlogPosting">
          
          
            <div class="post-header main-content-wrap text-left">
  
    <h1 class="post-title" itemprop="headline">
      pandas
    </h1>
  
  
  <div class="postShorten-meta post-meta">
    
      <time itemprop="datePublished" datetime="2019-12-22T22:41:21&#43;08:00">
        
  十二月 22, 2019

      </time>
    
    
  
  
    <span>发布在</span>
    
      <a class="category-link" href="https://ifence.gitee.io/categories/python">Python</a>
    
  

  </div>

</div>
          
          <div class="post-content markdown" itemprop="articleBody">
            <div class="main-content-wrap">
              

<h2 id="前言">前言</h2>

<p>pandas的DataFrame是类似于一张表的结构，但是并没有像数据库表那样的SQL操作。虽然如此，它依然可以使用python语言的风格实现SQL中的所有操作。</p>

<h2 id="where-limit-sort-by和order-by">where、limit、sort by和order by</h2>

<p>首先我们讲一些常用的最基本的SQL操作。，首先创建一个DataFrame。</p>

<pre><code class="language-python"># 首先构建一个df,用于执行相关操作
import numpy as np
import pandas as pd

index = pd.date_range('20191201',periods=30)
df = pd.DataFrame(np.random.randn(30,7),index=index,columns=['Sun','Mon','Tues','Wed','Thur','Fri','Set'])
</code></pre>

<pre><code class="language-python"># 查询df表中，12月前五天工作日的所有数据
# sql:select Mon, Tues, Wed, Thur, Fri from df limit 5;
# pandas DataFrame方式
df[['Mon','Tues','Wed','Thur','Fri']].head() # 默认取前5
'''
			Mon			Tues		Wed			Thur		Fri
2019-12-01	0.804610	0.368983	-0.601083	-1.245074	-0.484798
2019-12-02	1.260151	-1.409303	-0.634084	-1.036428	2.090475
2019-12-03	-1.728074	0.906895	0.015032	-1.311078	-1.329503
2019-12-04	-0.489368	-1.285120	-0.115737	0.138407	-1.360219
2019-12-05	-0.686239	-0.715345	-1.216979	-0.110652	-0.716998
'''
</code></pre>

<pre><code class="language-python"># 使用where条件，过滤大于Mon大于1的行,并且是工作日的列,并按照Mon降序排序,去除前五行
# SQL：select Mon,Tues,Wed,Thur,Fri from df where Mon &gt; 0 order by Mon desc limit 5;
df[df['Mon'] &gt; 1][['Mon','Tues','Wed','Thur','Fri']].sort_values('Mon',ascending=False).head()
'''
			Mon			Tues		Wed			Thur		Fri
2019-12-24	3.428393	-0.117491	-1.050417	0.013496	0.744957
2019-12-22	2.264095	0.580407	1.992808	0.277741	0.691637
2019-12-18	1.919169	1.108332	1.135021	0.468483	0.718493
2019-12-29	1.442418	-0.555409	1.483127	-0.322987	0.480643
2019-12-11	1.304989	0.289543	0.591583	-0.420857	-0.407957
'''
</code></pre>

<h2 id="where多条件查询">where多条件查询</h2>

<h3 id="and条件">and条件</h3>

<pre><code class="language-python"># where中有多个条件,要注意两个条件如果是and用&amp;，且条件要用小括号包裹一下
# select * from df where Sun &gt; 0 and Mon &lt; 0 order by Sun desc;
df[(df['Sun'] &gt; 0) &amp; (df['Mon'] &lt; 0)].sort_values('Sun',ascending=False)
'''
			Sun			Mon			Tues		Wed			Thur		Fri		Set
2019-12-04	2.196878	-0.489368	-1.285120	-0.115737	0.138407	-1.360219	0.093402
2019-12-25	1.245318	-2.336478	0.166749	0.665577	-1.740905	-0.719664	0.011632
2019-12-21	0.984376	-0.395367	0.859675	0.035257	-0.326325	2.049639	-0.104049
2019-12-20	0.916271	-2.208159	0.680670	-1.392549	0.310099	-0.655601	1.008948
2019-12-08	0.680180	-0.682509	0.263885	0.270527	0.428712	-0.566694	-0.426841
2019-12-03	0.552253	-1.728074	0.906895	0.015032	-1.311078	-1.329503	-1.179729
'''
</code></pre>

<h3 id="or条件">or条件</h3>

<pre><code class="language-python"># or条件,在DataFrame中使用的是按位或符号：|
# sql: select * from df where Sun &gt; 1 or Set &gt; 1 order by Sun;
df[(df['Sun'] &gt; 1) | (df['Set'] &gt;1)].sort_values('Sun',ascending=False)
'''
			Sun			Mon			Tues		Wed			Thur		Fri		Set
2019-12-19	2.200183	1.126807	1.650156	0.165897	1.262572	1.083929	2.151953
2019-12-04	2.196878	-0.489368	-1.285120	-0.115737	0.138407	-1.360219	0.093402
2019-12-25	1.245318	-2.336478	0.166749	0.665577	-1.740905	-0.719664	0.011632
2019-12-07	1.189126	0.115880	0.237899	-0.265956	0.882976	-0.932736	0.385194
2019-12-20	0.916271	-2.208159	0.680670	-1.392549	0.310099	-0.655601	1.008948
2019-12-14	0.063325	0.553131	0.221180	0.265838	0.260798	1.100413	1.112681
'''
</code></pre>

<h2 id="空值查询">空值查询</h2>

<p>在DataFrame中判断空值使用isna()和notna()两个方法</p>

<pre><code class="language-python"># 先构造一个带空置的DataFrame
dfna = pd.DataFrame({
    &quot;one&quot;:pd.Series([1,2,3,np.NaN,5,6]),
    &quot;two&quot;:pd.Series([1,2,np.NaN,5,6,np.NaN]),
    &quot;three&quot;:pd.Series([np.NaN,5,6,np.NaN,7,8]),
})

# 查询three列不是空值的全部数据
# SQL：select * from dfna where three is not null;
dfna[dfna['three'].notna()]
'''
	one	two	three
1	2.0	2.0	5.0
2	3.0	NaN	6.0
4	5.0	6.0	7.0
5	6.0	NaN	8.0
'''
# 查询表中three是空值的全部列
# SQL：select * from dfna where three is null;
dfna[dfna['three'].isna()]
'''
	one	two	three
0	1.0	1.0	NaN
3	NaN	5.0	NaN
'''
</code></pre>

<h2 id="分组">分组</h2>

<ul>
<li>先创建一个表，用于分组测试用</li>
<li>DataFrame的分组与SQL最大的不同时，SQL只能对分组列进行聚合，但是DataFrame不止可以对分组列聚合，其他列只要可以进行聚合操作都可以进行聚合</li>
<li>DataFrame可以对多列进行不同类型的聚合运算，需要使用agg函数并传入一个dict对象</li>

<li><p>可以使用多列作为条件进行分组</p>

<pre><code class="language-python"># 人员基本信息表
fdf = pd.DataFrame({
&quot;name&quot;:pd.Series(['Zero','Zoey','Bella','Kat','Sid']),
&quot;age&quot;:pd.Series([23,24,23,26,23]),
&quot;gender&quot;:pd.Series(['male','female','female','female','male']),
&quot;address&quot;:pd.Series(['jinan','nanjing','qingdao','dongjing','dongjing']),
&quot;salary&quot;:pd.Series([8888.8,6666.6,1234.5,2345.6,5678.9])
})

# 按性别分组，求出男女的平均工资
fdf.groupby('gender').mean()['salary']
'''
gender
female    3415.566667
male      7283.850000
Name: salary, dtype: float64
'''

#求出男女人数
fdf.groupby('gender').size()
'''
gender
female    3
male      2
dtype: int64
'''

# 分组后对不同列进行不同类型的聚合
# 按照gender进行分组，对salary求平均值，对age求总数
fdf.groupby('gender').agg({'salary':np.mean, 'age':np.size})
'''
		salary		age
gender		
female	3415.566667	 3
male	7283.850000	 2
'''
</code></pre></li>
</ul>

<h2 id="join">JOIN</h2>

<ul>
<li>join跟sql一样支持左外、右外，全外和内连接四种连接</li>
<li>先创建两个df用于进行join操作</li>

<li><p>DataFrame可以使用join()和merge()两种函数进行join操作，这里使用merge进行测试</p>

<pre><code class="language-python"># 创建两个待join的表
df1 = pd.DataFrame({
&quot;key&quot;:['A','B','C','D','E'],
&quot;val&quot;:np.random.randn(5)
})
df2 = pd.DataFrame({
&quot;key&quot;:['C','B','F','H','D'],
&quot;val&quot;:pd.Series(np.random.randn(5))
})

# 根据key列进行join操作,内连接
df1.merge(df2,on='key')
# 右外连接
df1.merge(df2, on='key', how='right')
# 左外连接
df1.merge(df2, on='key', how='left')
# 全外连接
df2.merge(df2, on='key', how='outer')
# 全外,上面的全外不是真的全外，要用这种方式才能做到全外连接
pd.merge(df1, df2, on='key',how='outer')
</code></pre></li>
</ul>

<h2 id="union">Union</h2>

<ul>
<li>union操作使用concat()进行完成</li>
<li>concat是pandas的函数笔试dataframe的函数</li>

<li><p>concat接受一个数组作为入参，所以在进行union的时候，需要将多个df放入一个数组中</p>

<pre><code class="language-python"># 合并两个DataFrame并去重
pd.concat([df1, df2]).drop_duplicates()
'''
key	val
0	A	-0.309694
1	B	1.455732
2	C	0.436620
3	D	0.970044
4	E	-0.689002
0	C	0.405784
1	B	-0.522076
2	F	0.147848
3	H	-1.609153
4	D	1.205187
'''
</code></pre></li>
</ul>

<h2 id="添加一列">添加一列</h2>

<pre><code class="language-python">df1.assign(score=np.random.randint(60,100,size=5))
'''
key	val	score
0	A	-0.309694	80
1	B	1.455732	92
2	C	0.436620	92
3	D	0.970044	95
4	E	-0.689002	89
'''
</code></pre>

<h2 id="top-n-相关函数">top N 相关函数</h2>

<ul>
<li>在DataFrame中有直接求top N的函数</li>
<li>nlargest（n,col）求col列中前n大的行</li>

<li><p>nsmallest(n,col)求col列中前n小的行</p>

<pre><code class="language-python">df.nlargest(3,columns='Sun')
df.nsmallest(3,columns='Sun')
</code></pre>

<pre><code class="language-python"># 这里也是top N，但是是基于分组的top N
# assign是添加一列
# 添加的列叫rn
# sort_values是对salary进行排序
# groupby是对gender进行分组
# cumcount是按照上面给定的顺序从0开始给一个顺序号
fdf.assign(
rn=fdf.sort_values(['salary'], ascending=False)
.groupby(['gender'])
.cumcount()+1
).sort_values('name')
# 下面的结果说明了男女中工资从低到高的排序顺序
'''
	name	age	gender	address	salary	rn
2	Bella	23	female	qingdao	1234.5	3
3	Kat	26	female	dongjing	2345.6	2
4	Sid	23	male	dongjing	5678.9	2
0	Zero	23	male	jinan	8888.8	1
1	Zoey	24	female	nanjing	6666.6	1
'''
</code></pre></li>
</ul>

<h2 id="连接mysql和oracle">连接Mysql和Oracle</h2>

<h3 id="pandas连接mysql数据库">pandas连接mysql数据库</h3>

<pre><code class="language-python">from sqlalchemy import create_engine
# 获取与mysql的连接
engine = create_engine('mysql+pymysql://root:key123@localhost/test')
# 写一条SQL语句
sql = 'select * from user'
# 使用pandas读取数据库表为df
mysql_df = pd.read_sql(sql,engine)
mysql_df.head()
'''
	name id	age	score
0	aa	 1	12	87
1	ss	 2	12	85
2	dd	 3	12	84
3	ff	 4	12	80
4	gg	 5	12	90
'''
</code></pre>

<h3 id="pandas连接oracle">pandas连接Oracle</h3>

<ul>
<li>与连接mysql一样，也可以不使用传统方法进行连接，而是使用下面这种比较高效的方式</li>

<li><p>需要注意的是SQL语句中不能有分号</p>

<pre><code class="language-python">orcl_engine = create_engine('oracle://stythgk:stythgk@58.56.114.58:11521/orcl')
sql = 'select * from t_zdry_ryjbxx'
orcl_df = pd.read_sql(sql, orcl_engine)
orcl_df[['xm','sfzh','csrq','xb','accent']].head(5).sort_values('csrq')
'''
	xm		sfzh			csrq		xb	accent
2	宋殿宁	370105198405255317	1978-09-16	1	None
1	张福顺	370105196402160313	1980-12-11	2	110000
3	范振河	370111196505175339	1985-12-08	1	None
4	党培强	370121197007013932	1993-11-22	2	None
0	王建全	370105196401200838	1994-01-17	2	None
'''
</code></pre></li>
</ul>

<h2 id="总结">总结</h2>

<p>pandas是一个非常强大的科学计算库，DataFrame的功能也远不止这么简单。这里只是总结了一些常用的类似于SQL的操作方法。如果需要更加复杂的功能可以查看DataFrame的官方文档。</p>

              
            </div>
          </div>
          <div id="post-footer" class="post-footer main-content-wrap">
            
              
                
                
                  <div class="post-footer-tags">
                    <span class="text-color-light text-small">标签</span><br/>
                    
  <a class="tag tag--primary tag--small" href="https://ifence.gitee.io/tags/python/">python</a>

  <a class="tag tag--primary tag--small" href="https://ifence.gitee.io/tags/pandas/">pandas</a>

  <a class="tag tag--primary tag--small" href="https://ifence.gitee.io/tags/dataframe/">DataFrame</a>

                  </div>
                
              
            
            <div class="post-actions-wrap">
  
      <nav >
        <ul class="post-actions post-action-nav">
          
            <li class="post-action">
              
                <a class="post-action-btn btn btn--disabled">
              
                  <i class="fa fa-angle-left"></i>
                  <span class="hide-xs hide-sm text-small icon-ml">下一篇</span>
                </a>
            </li>
            <li class="post-action">
              
                <a class="post-action-btn btn btn--default tooltip--top" href="https://ifence.gitee.io/2019/09/scala%E4%B8%ADcontinue%E5%92%8Cbreak%E7%9A%84%E5%87%A0%E7%A7%8D%E5%AE%9E%E7%8E%B0%E6%96%B9%E5%BC%8F/" data-tooltip="Scala中continue和break的几种实现方式">
              
                  <span class="hide-xs hide-sm text-small icon-mr">上一篇</span>
                  <i class="fa fa-angle-right"></i>
                </a>
            </li>
          
        </ul>
      </nav>
    <ul class="post-actions post-action-share" >
      
        <li class="post-action hide-lg hide-md hide-sm">
          <a class="post-action-btn btn btn--default btn-open-shareoptions" href="#btn-open-shareoptions">
            <i class="fa fa-share-alt"></i>
          </a>
        </li>
        
      
      
        <li class="post-action">
          <a class="post-action-btn btn btn--default" href="#disqus_thread">
            <i class="fa fa-comment-o"></i>
          </a>
        </li>
      
      <li class="post-action">
        
          <a class="post-action-btn btn btn--default" href="#">
        
          <i class="fa fa-list"></i>
        </a>
      </li>
    </ul>
  
</div>

            
              
                <div id="disqus_thread">
  <noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>
              
            
          </div>
        </article>
        <footer id="footer" class="main-content-wrap">
  <span class="copyrights">
    &copy; 2019 iFence. All Rights Reserved
  </span>
</footer>

      </div>
      <div id="bottom-bar" class="post-bottom-bar" data-behavior="5">
        <div class="post-actions-wrap">
  
      <nav >
        <ul class="post-actions post-action-nav">
          
            <li class="post-action">
              
                <a class="post-action-btn btn btn--disabled">
              
                  <i class="fa fa-angle-left"></i>
                  <span class="hide-xs hide-sm text-small icon-ml">下一篇</span>
                </a>
            </li>
            <li class="post-action">
              
                <a class="post-action-btn btn btn--default tooltip--top" href="https://ifence.gitee.io/2019/09/scala%E4%B8%ADcontinue%E5%92%8Cbreak%E7%9A%84%E5%87%A0%E7%A7%8D%E5%AE%9E%E7%8E%B0%E6%96%B9%E5%BC%8F/" data-tooltip="Scala中continue和break的几种实现方式">
              
                  <span class="hide-xs hide-sm text-small icon-mr">上一篇</span>
                  <i class="fa fa-angle-right"></i>
                </a>
            </li>
          
        </ul>
      </nav>
    <ul class="post-actions post-action-share" >
      
        <li class="post-action hide-lg hide-md hide-sm">
          <a class="post-action-btn btn btn--default btn-open-shareoptions" href="#btn-open-shareoptions">
            <i class="fa fa-share-alt"></i>
          </a>
        </li>
        
      
      
        <li class="post-action">
          <a class="post-action-btn btn btn--default" href="#disqus_thread">
            <i class="fa fa-comment-o"></i>
          </a>
        </li>
      
      <li class="post-action">
        
          <a class="post-action-btn btn btn--default" href="#">
        
          <i class="fa fa-list"></i>
        </a>
      </li>
    </ul>
  
</div>

      </div>
      <div id="share-options-bar" class="share-options-bar" data-behavior="5">
  <i id="btn-close-shareoptions" class="fa fa-close"></i>
  <ul class="share-options">
    
  </ul>
</div>
<div id="share-options-mask" class="share-options-mask"></div>
    </div>
    
    <div id="about">
  <div id="about-card">
    <div id="about-btn-close">
      <i class="fa fa-remove"></i>
    </div>
    
      <img id="about-card-picture" src="https://avatars1.githubusercontent.com/u/53120100?s=460&amp;v=4" alt="作者的图片" />
    
    <h4 id="about-card-name">iFence</h4>
    
      <div id="about-card-bio">虽千万人吾往矣</div>
    
    
      <div id="about-card-job">
        <i class="fa fa-briefcase"></i>
        <br/>
        大数据开发
      </div>
    
    
      <div id="about-card-location">
        <i class="fa fa-map-marker"></i>
        <br/>
        中国 山东
      </div>
    
  </div>
</div>

    

    
  
    
      <div id="cover" style="background-image:url('https://ifence.gitee.io/images/cover.jpg');"></div>
    
  


    
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js" integrity="sha256-/BfiIkHlHoVihZdc6TFuj7MmJ0TWcWsMXkeDFwhi0zw=" crossorigin="anonymous"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.7/js/jquery.fancybox.min.js" integrity="sha256-GEAnjcTqVP+vBp3SSc8bEDQqvWAZMiHyUSIorrWwH50=" crossorigin="anonymous"></script>


<script src="https://ifence.gitee.io/js/script-pcw6v3xilnxydl1vddzazdverrnn9ctynvnxgwho987mfyqkuylcb1nlt.min.js"></script>


<script lang="javascript">
window.onload = updateMinWidth;
window.onresize = updateMinWidth;
document.getElementById("sidebar").addEventListener("transitionend", updateMinWidth);
function updateMinWidth() {
  var sidebar = document.getElementById("sidebar");
  var main = document.getElementById("main");
  main.style.minWidth = "";
  var w1 = getComputedStyle(main).getPropertyValue("min-width");
  var w2 = getComputedStyle(sidebar).getPropertyValue("width");
  var w3 = getComputedStyle(sidebar).getPropertyValue("left");
  main.style.minWidth = `calc(${w1} - ${w2} - ${w3})`;
}
</script>

<script>
$(document).ready(function() {
  hljs.configure({ classPrefix: '', useBR: false });
  $('pre.code-highlight > code, pre > code').each(function(i, block) {
    if (!$(this).hasClass('codeblock')) {
      $(this).addClass('codeblock');
    }
    hljs.highlightBlock(block);
  });
});
</script>


  
    
      <script>
        var disqus_config = function () {
          this.page.url = 'https:\/\/ifence.gitee.io\/2019\/12\/pandas\/';
          
            this.page.identifier = '\/2019\/12\/pandas\/'
          
        };
        (function() {
          
          
          if (window.location.hostname == "localhost") {
            return;
          }
          var d = document, s = d.createElement('script');
          var disqus_shortname = 'hugo-tranquilpeak-theme';
          s.src = '//' + disqus_shortname + '.disqus.com/embed.js';

          s.setAttribute('data-timestamp', +new Date());
          (d.head || d.body).appendChild(s);
        })();
      </script>
    
  




    
  </body>
</html>

